package com.peng.sta.controller;


import com.peng.sta.service.StatisticsDailyService;
import com.peng.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author Dengp
 * @since 2022-06-25
 */
@RestController
@RequestMapping("/sta/statistics")
@CrossOrigin
public class StatisticsDailyController {
    @Autowired
    private StatisticsDailyService statisticsDailyService;

    //根据日期统计当天注册人数
    @GetMapping("/countRegister/{day}")
    public Result countRegister(@PathVariable String day){
        statisticsDailyService.countRegister(day);
        return Result.ok();
    }

    //根据时期统计人数
    @GetMapping("/showData/{type}/{begin}/{end}")
    public Result showData(@PathVariable String type, @PathVariable String begin,@PathVariable String end){
        Map<String,Object> map= statisticsDailyService.showData(type,begin,end);
        return Result.ok().data(map);
    }
}

